<template>
    <div class="exchange">
        <slider :content='sliderImgs'></slider>
        <div class="bomb-exchange" v-for="(item,index) in realData" :key="index">
            <star-title :content='item["name"]'></star-title>
            <div class="bomb-exchange-list">
                <double-integral :content='item.goods'></double-integral>
            </div>
        </div>
        <nothing></nothing>
    </div>
</template>

<script>
import virtualData from './virtual'
import slider from '../../public/slider'
import nothing from '../../public/nothing'
import starTitle from '../../public/starTitle'
import doubleIntegral from '../../public/doubleIntegral'

export default {
    name:'exchange',
    data(){
        return {
            virtual:virtualData,
            titleList:['火爆兑换'],
            sliderImgs:[],
            realData:[]
        }
    },
    methods:{
        getSliders(){
            let that = this;
            let token = localStorage.getItem('token');
            that.$ajax(that, 'get', that.$api.mainSliders+5, null, token, function(res){
                // console.log(res);
                if(res.data['error_code'] == 0){
                    that.sliderImgs = res.data['msg'];
                    that.transferUrl(that.sliderImgs);
                }
            })
        },
        getExchange(){
            let that = this;
            let token = localStorage.getItem('token');
            that.$ajax(that, 'get', that.$api.homeFive+5, null, token, function(res){
                if(res.data['error_code'] == 0){
                    that.realData = res.data['msg'];
                }
            })
        }
    },
    mounted(){
        this.getSliders();
        this.getExchange();
    },
    components:{
        slider,
        nothing,
        starTitle,
        doubleIntegral
    }
}
</script>

<style lang='less'>
@rem:100rem;

.exchange{
    width: 750/@rem;
    background: #fff;
    margin-bottom: 96/@rem;
}

</style>
